home *** CD-ROM | disk | FTP | other *** search
/ Mac Easy 2010 May / Mac Life Ubuntu.iso / casper / filesystem.squashfs / usr / lib / python2.6 / distutils / command / build.pyc (.txt) < prev    next >
Encoding:
Python Compiled Bytecode  |  2009-04-20  |  5.1 KB  |  114 lines

  1. # Source Generated with Decompyle++
  2. # File: in.pyc (Python 2.6)
  3.  
  4. """distutils.command.build
  5.  
  6. Implements the Distutils 'build' command."""
  7. __revision__ = '$Id: build.py 62197 2008-04-07 01:53:39Z mark.hammond $'
  8. import sys
  9. import os
  10. from distutils.core import Command
  11. from distutils.errors import DistutilsOptionError
  12. from distutils.util import get_platform
  13.  
  14. def show_compilers():
  15.     show_compilers = show_compilers
  16.     import distutils.ccompiler
  17.     show_compilers()
  18.  
  19.  
  20. class build(Command):
  21.     description = 'build everything needed to install'
  22.     user_options = [
  23.         ('build-base=', 'b', 'base directory for build library'),
  24.         ('build-purelib=', None, 'build directory for platform-neutral distributions'),
  25.         ('build-platlib=', None, 'build directory for platform-specific distributions'),
  26.         ('build-lib=', None, 'build directory for all distribution (defaults to either ' + 'build-purelib or build-platlib'),
  27.         ('build-scripts=', None, 'build directory for scripts'),
  28.         ('build-temp=', 't', 'temporary build directory'),
  29.         ('plat-name=', 'p', 'platform name to build for, if supported (default: %s)' % get_platform()),
  30.         ('compiler=', 'c', 'specify the compiler type'),
  31.         ('debug', 'g', 'compile extensions and libraries with debugging information'),
  32.         ('force', 'f', 'forcibly build everything (ignore file timestamps)'),
  33.         ('executable=', 'e', 'specify final destination interpreter path (build.py)')]
  34.     boolean_options = [
  35.         'debug',
  36.         'force']
  37.     help_options = [
  38.         ('help-compiler', None, 'list available compilers', show_compilers)]
  39.     
  40.     def initialize_options(self):
  41.         self.build_base = 'build'
  42.         self.build_purelib = None
  43.         self.build_platlib = None
  44.         self.build_lib = None
  45.         self.build_temp = None
  46.         self.build_scripts = None
  47.         self.compiler = None
  48.         self.plat_name = None
  49.         self.debug = None
  50.         self.force = 0
  51.         self.executable = None
  52.  
  53.     
  54.     def finalize_options(self):
  55.         if self.plat_name is None:
  56.             self.plat_name = get_platform()
  57.         elif os.name != 'nt':
  58.             raise DistutilsOptionError("--plat-name only supported on Windows (try using './configure --help' on your platform)")
  59.         
  60.         plat_specifier = '.%s-%s' % (self.plat_name, sys.version[0:3])
  61.         if hasattr(sys, 'gettotalrefcount'):
  62.             plat_specifier += '-pydebug'
  63.         
  64.         if self.build_purelib is None:
  65.             self.build_purelib = os.path.join(self.build_base, 'lib' + plat_specifier)
  66.         
  67.         if self.build_platlib is None:
  68.             self.build_platlib = os.path.join(self.build_base, 'lib' + plat_specifier)
  69.         
  70.         if self.build_lib is None:
  71.             if self.distribution.ext_modules:
  72.                 self.build_lib = self.build_platlib
  73.             else:
  74.                 self.build_lib = self.build_purelib
  75.         
  76.         if self.build_temp is None:
  77.             self.build_temp = os.path.join(self.build_base, 'temp' + plat_specifier)
  78.         
  79.         if self.build_scripts is None:
  80.             self.build_scripts = os.path.join(self.build_base, 'scripts-' + sys.version[0:3])
  81.         
  82.         if self.executable is None:
  83.             self.executable = os.path.normpath(sys.executable)
  84.         
  85.  
  86.     
  87.     def run(self):
  88.         for cmd_name in self.get_sub_commands():
  89.             self.run_command(cmd_name)
  90.         
  91.  
  92.     
  93.     def has_pure_modules(self):
  94.         return self.distribution.has_pure_modules()
  95.  
  96.     
  97.     def has_c_libraries(self):
  98.         return self.distribution.has_c_libraries()
  99.  
  100.     
  101.     def has_ext_modules(self):
  102.         return self.distribution.has_ext_modules()
  103.  
  104.     
  105.     def has_scripts(self):
  106.         return self.distribution.has_scripts()
  107.  
  108.     sub_commands = [
  109.         ('build_py', has_pure_modules),
  110.         ('build_clib', has_c_libraries),
  111.         ('build_ext', has_ext_modules),
  112.         ('build_scripts', has_scripts)]
  113.  
  114.